package com.woshua.splashmodel;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.FrameLayout;

import com.woshua.splashmodel.view.ContentView;
import com.woshua.splashmodel.view.SplashView;

public class MainActivity extends AppCompatActivity {

    private FrameLayout mainView;

    private Handler handler=new Handler();
    private SplashView splashView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main);
        //SplashView ContentView

        splashView = new SplashView(this);
        ContentView contentView=new ContentView(this);

        mainView=new FrameLayout(this);
        mainView.addView(contentView);
        mainView.addView(splashView);



        setContentView(mainView);

        startLoadState();
    }

    private void startLoadState() {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                //第一个动画停止，开始下一个动画
                splashView.stopSplashAndJumpToMain();
            }
        },3000);
    }
}
